package main

import (
	"bytes"
	"fmt"
	"strings"
)

func main() {

	reader := strings.NewReader("123abcxyz")
	ctx := make([]byte, 5)
	n, err := reader.Read(ctx)
	fmt.Println(n, err, string(ctx[:n]))

	n, err = reader.Read(ctx)
	fmt.Println(n, err, string(ctx[:n]))

	var builder strings.Builder
	builder.WriteString("你好")
	fmt.Println(builder.String())

	buffer := bytes.NewBuffer([]byte("12345"))
	len := buffer.Len()
	fmt.Println(len)
	ctx = make([]byte, len)
	buffer.Read(ctx)
	fmt.Println(string(ctx))
}
